export async function selectFile() {
    // 打开文件选择器（可选指定文件类型）
    const fileTypes = [
        ["图像文件", "*.png;*.jpg;*.jpeg"],
        ["所有文件", "*.*"]
    ];

    const filePath = await window.pywebview.api.open_file_dialog("选择图像", fileTypes);
    if (filePath) {
        return filePath;
    }else {
        throw new Error("NO SELECT");
    }
}


export async function selectFolder() {
    const folderPath = await window.pywebview.api.open_folder_dialog("选择文件夹");
    if (folderPath) {
        return folderPath;
    }else {
        throw new Error("NO SELECT");
    }
}


export async function selectMultipleFiles() {
    const filePaths = await window.pywebview.api.open_multiple_files_dialog("选择多个文件");
    if (filePaths?.length > 0) {
        return filePaths;
    }else {
        throw new Error("NO SELECT");
    }
}